import { Provider } from "react-redux";
import { ConfigProvider } from "antd";
import { BrowserRouter } from "react-router-dom";
import { PersistGate } from "redux-persist/integration/react";
import "dayjs/locale/zh-cn";
import locale from "antd/es/locale/zh_CN";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
import relativeTime from "dayjs/plugin/relativeTime";
import dayjs from "dayjs";

import "./App.less";
import MyRoutes from "./router/index";
import { store, persistor } from "./store/configureStore";

dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.extend(relativeTime);

export { dayjs };

function App() {
  return (
    <ConfigProvider locale={locale}>
      <Provider store={store}>
        <PersistGate persistor={persistor}>
          <BrowserRouter>
            <MyRoutes />
          </BrowserRouter>
        </PersistGate>
      </Provider>
    </ConfigProvider>
  );
}

export default App;
